package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlTransient;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@Table(name = "banco",catalog = "bdcotelasa", schema = "cotelasa", uniqueConstraints = @UniqueConstraint(columnNames = "nombre"))
@NamedQueries({
    @NamedQuery(name = "Banco.findAll", query = "SELECT b FROM Banco b"),
    @NamedQuery(name = "Banco.findById", query = "SELECT b FROM Banco b WHERE b.id = :id"),
    @NamedQuery(name = "Banco.findByNombre", query = "SELECT b FROM Banco b WHERE b.nombre = :nombre"),
    @NamedQuery(name = "Banco.findByContactoNombre", query = "SELECT b FROM Banco b WHERE b.contactoBanco = :contactoBanco"),
    @NamedQuery(name = "Banco.findByTelefonoContacto", query = "SELECT b FROM Banco b WHERE b.telefonoContacto = :telefonoContacto"),
    @NamedQuery(name = "Banco.findByCorreoContacto", query = "SELECT b FROM Banco b WHERE b.correoContacto = :correoContacto"),
    @NamedQuery(name = "Banco.findByObservacion", query = "SELECT b FROM Banco b WHERE b.observacion = :observacion"),
    @NamedQuery(name = "Banco.findByEstadoRegistro", query = "SELECT b FROM Banco b WHERE b.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "Banco.findByUsrCreacion", query = "SELECT b FROM Banco b WHERE b.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "Banco.findByFecCreacion", query = "SELECT b FROM Banco b WHERE b.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "Banco.findByUsrModificacion", query = "SELECT b FROM Banco b WHERE b.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "Banco.findByFecModificacion", query = "SELECT b FROM Banco b WHERE b.fecModificacion = :fecModificacion")})
public class Banco implements Serializable {


    private static final long serialVersionUID = -8091315909674086895L;
    
    @Id
    @SequenceGenerator(name = "generadorBanco", sequenceName = "cotelasa.banco_id_seq")
    @GeneratedValue(generator = "generadorBanco")
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    
    @Column(name = "contacto_banco")
    private String contactoBanco;
    
    @Column(name = "telefono_contacto")
    private String telefonoContacto;
    
    @Column(name = "correo_contacto")
    private String correoContacto;
    
    @Column(name = "observacion")
    private String observacion;
    
    @Basic(optional = false)
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idBanco", fetch = FetchType.LAZY)
    private Collection<CuentaBancaria> cuentaBancariaCollection;

    public Banco() {
    }

    public Banco(Integer id) {
        this.id = id;
    }

    public Banco(Integer id, String nombre, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.nombre = nombre;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getContactoBanco() {
        return contactoBanco;
    }

    public void setContactoBanco(String contactoBanco) {
        this.contactoBanco = contactoBanco;
    }

    public String getTelefonoContacto() {
        return telefonoContacto;
    }

    public void setTelefonoContacto(String telefonoContacto) {
        this.telefonoContacto = telefonoContacto;
    }

    public String getCorreoContacto() {
        return correoContacto;
    }

    public void setCorreoContacto(String correoContacto) {
        this.correoContacto = correoContacto;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public Collection<CuentaBancaria> getCuentaBancariaCollection() {
        return cuentaBancariaCollection;
    }

    public void setCuentaBancariaCollection(Collection<CuentaBancaria> cuentaBancariaCollection) {
        this.cuentaBancariaCollection = cuentaBancariaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Banco)) {
            return false;
        }
        Banco other = (Banco) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.com.cotelasa.scp.entidad.Banco[ id=" + id + " ]";
    }

   
}
